home *** CD-ROM | disk | FTP | other *** search
/ Aminet 40 / Aminet 40 (2000)(Schatztruhe)[!][Dec 2000].iso / Aminet / dev / lang / Python16_Src.lha / Python16_Source / Python / sigcheck.c < prev    next >
Encoding:
C/C++ Source or Header  |  2000-09-10  |  896 b   |  33 lines

  1. /* Sigcheck is similar to intrcheck() but sets an exception when an
  2.    interrupt occurs.  It can't be in the intrcheck.c file since that
  3.    file (and the whole directory it is in) doesn't know about objects
  4.    or exceptions.  It can't be in errors.c because it can be
  5.    overridden (at link time) by a more powerful version implemented in
  6.    signalmodule.c. */
  7.  
  8. #include "Python.h"
  9.  
  10. #ifdef __SASC
  11. /* Replacement stack overflow routine for SAS/C */
  12. void __stdargs _CXOVF(void)
  13. {
  14.     PyErr_SetString(PyExc_MemoryError,"too deep recursion");
  15. }
  16. #endif /* __SASC */
  17.  
  18. /* ARGSUSED */
  19. int
  20. PyErr_CheckSignals()
  21. {
  22. #ifdef __SASC
  23. /* Amiga SAS/C: Explicit check of available stack */
  24. extern unsigned long stackavail(void);
  25. extern long __STKNEED;
  26. if(stackavail()<__STKNEED) return _CXOVF(),-1;
  27. #endif /* __SASC */
  28.     if (!PyOS_InterruptOccurred())
  29.         return 0;
  30.     PyErr_SetNone(PyExc_KeyboardInterrupt);
  31.     return -1;
  32. }
  33.